package com.springboot.cms.blogroll.service.impl;


import com.springboot.cms.blogroll.domain.CmsBlogroll;
import com.springboot.cms.blogroll.mapper.CmsBlogrollMapper;
import com.springboot.cms.blogroll.service.ICmsBlogrollService;
import com.springboot.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 友情链接Service业务层处理
 *
 * @author lhxz
 * @date 2024-07-01
 */
@Service
public class CmsBlogrollServiceImpl implements ICmsBlogrollService
{
    @Autowired
    private CmsBlogrollMapper cmsBlogrollMapper;

    /**
     * 查询友情链接
     *
     * @param id 友情链接主键
     * @return 友情链接
     */
    @Override
    public CmsBlogroll selectCmsBlogrollById(Long id)
    {
        return cmsBlogrollMapper.selectCmsBlogrollById(id);
    }

    /**
     * 查询友情链接列表
     *
     * @param cmsBlogroll 友情链接
     * @return 友情链接
     */
    @Override
    public List<CmsBlogroll> selectCmsBlogrollList(CmsBlogroll cmsBlogroll)
    {
        return cmsBlogrollMapper.selectCmsBlogrollList(cmsBlogroll);
    }

    /**
     * 新增友情链接
     *
     * @param cmsBlogroll 友情链接
     * @return 结果
     */
    @Override
    public int insertCmsBlogroll(CmsBlogroll cmsBlogroll)
    {
        cmsBlogroll.setCreateTime(DateUtils.getNowDate());
        return cmsBlogrollMapper.insertCmsBlogroll(cmsBlogroll);
    }

    /**
     * 修改友情链接
     *
     * @param cmsBlogroll 友情链接
     * @return 结果
     */
    @Override
    public int updateCmsBlogroll(CmsBlogroll cmsBlogroll)
    {
        cmsBlogroll.setUpdateTime(DateUtils.getNowDate());
        return cmsBlogrollMapper.updateCmsBlogroll(cmsBlogroll);
    }

    /**
     * 批量删除友情链接
     *
     * @param ids 需要删除的友情链接主键
     * @return 结果
     */
    @Override
    public int deleteCmsBlogrollByIds(Long[] ids)
    {
        return cmsBlogrollMapper.deleteCmsBlogrollByIds(ids);
    }

    /**
     * 删除友情链接信息
     *
     * @param id 友情链接主键
     * @return 结果
     */
    @Override
    public int deleteCmsBlogrollById(Long id)
    {
        return cmsBlogrollMapper.deleteCmsBlogrollById(id);
    }
}
